package com.xuexie.mr;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import org.apache.hadoop.io.WritableComparable;

public class MyBean implements WritableComparable<MyBean>{

	private int year;
	private int mounth;
	private double hot;
	
	public int getYear() {
		return year;
	}

	public void setYear(int year) {
		this.year = year;
	}

	public int getMounth() {
		return mounth;
	}

	public void setMounth(int mounth) {
		this.mounth = mounth;
	}

	public double getHot() {
		return hot;
	}

	public void setHot(double hot) {
		this.hot = hot;
	}

	public void readFields(DataInput arg0) throws IOException {
		year=arg0.readInt();
		mounth=arg0.readInt();
		hot=arg0.readDouble();
	}

	public void write(DataOutput arg0) throws IOException {
		arg0.writeInt(year);
		arg0.writeInt(mounth);
		arg0.writeDouble(hot);
	}

	public int compareTo(MyBean o) {
		int result =Integer.compare(this.year, o.year);
		if(result==0){
			result =Integer.compare(this.mounth, o.mounth);
			if(result==0){
				return Double.compare(this.hot, o.hot);
			}
		}
		return result;
	}

}
